Skip to content

feat(core): M5.1 — plugin subprocess + JSON-RPC bridge + token+env-strip#15

Merged
oratis merged 1 commit into
mainfrom
feat/m5.1-plugin-subprocess
May 28, 2026
Merged

feat(core): M5.1 — plugin subprocess + JSON-RPC bridge + token+env-strip#15
oratis merged 1 commit into
mainfrom
feat/m5.1-plugin-subprocess

Conversation

@oratis

@oratis oratis commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

PluginSubprocess spawns plugin in a separate node process with JSON-RPC stdio bridge. Host implements fs_read/fs_write/bash/fetch/log on plugin's behalf, gated by per-instance token. DEEPSEEK_API_KEY and DEEPSEEK_AUTH_TOKEN env vars stripped from child env so plugins can't exfil host credentials.

5 new tests · 313 passed / 8 skipped / 0 failed (was 308).

Deferred to M5.1-ext / M5.2

OS sandbox wrap around plugin process; gh:/npm install; marketplace signatures; revoke list; live ToolRegistry wire-up of spawned plugins.

Release notes

  • release-notes:feature

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…assing

What ships
----------
- plugins/runtime/subprocess.ts (~270 lines)
  · PluginSubprocess class — spawn plugin's index.js as separate node process
  · JSON-RPC stdio bridge — newline-framed, request/response correlated by id
  · Capability methods exposed to plugin (via plugin → host RPC):
    - fs_read(path) / fs_write(path, content)
    - bash(command)
    - fetch(url, opts)
    - log(msg)
  · Token validation on every RPC (defense against unauthorized callers)
  · DEEPSEEK_API_KEY / DEEPSEEK_AUTH_TOKEN env vars STRIPPED in child env
    (plugin cannot exfil host credentials)
  · spawnAllPlugins(plugins, host) / shutdownAllPlugins() bulk helpers
  · generatePluginToken() — collision-resistant token generator

What's exposed in @deepcode/core
- PluginSubprocess / spawnAllPlugins / shutdownAllPlugins /
  generatePluginToken (+ RpcRequest/Response, SpawnAllOpts types)

Tests (5 new, 321 total)
------------------------
- starts subprocess + clean shutdown
- plugin can request fs_read via RPC, host bridge fires + returns
- wrong token rejected (host bridge NOT fired)
- generatePluginToken yields unique values
- DEEPSEEK_API_KEY env var stripped in plugin process

Verified
--------
  pnpm typecheck   → green
  pnpm test        → 313 passed / 8 skipped / 0 failed (was 308)

What's intentionally NOT in this PR (per docs/design/plugin-security.md)
------------------------------------------------------------------------
- OS-level sandbox wrapping (bwrap/sandbox-exec around plugin process):
  M5.1-ext. Currently the plugin can still e.g. open arbitrary network
  connections — the token + env-strip protects host CREDENTIALS but not
  the broader threat surface.
- GitHub URL install ("gh:user/repo")
- npm install
- Marketplace ed25519 signature verification
- Revoke list pull/enforcement
- Wiring spawned plugins into the live ToolRegistry / hook chain — currently
  the subprocess infrastructure exists but the REPL doesn't yet spawn-and-
  register installed plugins. That last-mile wire-up is M5.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@oratis oratis merged commit 0388500 into main May 28, 2026
@oratis oratis deleted the feat/m5.1-plugin-subprocess branch May 28, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant